from sanic import Blueprint
from controllers.trade import TradeController
from decorators import response_json
from utils.parser import parse_args

bp = Blueprint("trade", url_prefix="/trade")


@bp.route("", methods=["POST"])
@response_json
async def analysis_strategy(request):
    """
    分析当下策略
    """
    args_rules = [
        dict(arg="strategy", required=True, type="str"),
    ]
    args = parse_args(request, "json", args_rules)

    res = TradeController.analysis_strategy(args["strategy"])
    return res

